package com.mucd.chat.controller;

import com.mucd.chat.service.FriendRequestService;
import com.ruoyi.common.core.domain.FriendDto;
import com.ruoyi.common.core.domain.FriendRequest;
import com.ruoyi.common.core.domain.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("friendRequest")
public class FriendRequestController {

    @Resource
    private FriendRequestService friendRequestService;


    @PostMapping("add")
    public R<?> add(@RequestBody FriendRequest friendRequest) {
        return R.ok(friendRequestService.add(friendRequest));
    }

    /**
     * 查询待同意的请求数量
     * 后续可能会添加群请求数量
     */
    @PostMapping("selectRequestCount")
    public R<?> selectRequestCount() {
        return R.ok(friendRequestService.selectRequestCount());
    }

    /**
     * 查询待同意的请求数量
     * 后续可能会添加群请求数量
     */
    @PostMapping("selectFriendRequestList")
    public R<?> selectFriendRequestList() {
        return R.ok(friendRequestService.selectFriendRequestList());
    }
    /**
     * 查询待同意的请求数量
     * 后续可能会添加群请求数量
     */
    @PostMapping("getRequestHistoryList")
    public R<?> getRequestHistoryList() {
        return R.ok(friendRequestService.getRequestHistoryList());
    }

    /**
     * 查询待同意的请求数量
     * 后续可能会添加群请求数量
     */
    @PostMapping(value = "confirmOrRejectFriend")
    public R<?> confirmOrRejectFriend(@RequestBody FriendRequest dto) {
        return R.ok(friendRequestService.confirmOrRejectFriend(dto));
    }


}
